"""
Copyright 2009, Thomas Dejanovic, Jay Shurtz.
 
This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.

Logging module for hatch. Should be imported as "from hatch_log import * ".
All hatch modules share the same logger instance.
"""

id = "$Id: hatch_log.py 667 2010-07-01 00:12:17Z jayshurtz $"
# $URL: http://hatch.googlecode.com/svn/tags/taggle_release_2.3/hatch/hatch_library/hatch_log.py $
# $Author: jayshurtz $
version = " ".join(id.split()[1:3])


import logging
from os.path import splitext
#import to_hatch_structure
#from hatch_node import hatchNodeClassAndName, hatchNodeErrorString
from hatch_generic_methods import hatchNodeClassAndName, hatchNodeErrorString

errorValue = "???"
errorComment = "(probably an error" + errorValue + ")"

logger = logging.getLogger(splitext(__file__)[0])  # XXX All hatch modules share this logger by importing this file.
logger.setLevel(logging.DEBUG)
consoleHandler = logging.StreamHandler()
consoleHandler.setLevel(logging.INFO)
#consoleHandler.setLevel(logging.DEBUG)
#formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
#consoleHandler.setFormatter(formatter)
logger.addHandler(consoleHandler)
del splitext


# Main for test
if __name__ == "__main__":

    consoleHandler.setLevel(logging.DEBUG)
    logger.info("Whoo!")


